package com.gientech.Controller;

import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/redis1/")
public class ProviderController {

    @Resource
    StringRedisTemplate stringRedisTemplate;
    @GetMapping("/set")
    public String set(){
        String key="myconfig";
        String value="this is my config";
        stringRedisTemplate.opsForValue().set(key,value);
        return "set success";
    }

    @GetMapping("/getvalue")
    public String getValue(){
        String key="myconfig";
        String s = stringRedisTemplate.opsForValue().get(key);
        return s;
    }

}
